package com.bee2c.pub.home.task.inter;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;

import com.bee2c.pub.home.task.PubTaskService;
import com.bee2c.pub.home.task.constants.TaskStatus;
import com.bee2c.pub.home.task.entity.PubTask;

public abstract class AbstractTaskProcessService implements TaskProcessService {

	@Autowired
	protected PubTaskService taskService;

	@Override
	public void createTask(String dataKey) {
		PubTask task = new PubTask();
		task.setTaskStatus(TaskStatus.W.getValue());
		task.setTransferType(this.getTransferType());
		task.setTaskType(this.getTaskType());
		task.setDataKey(dataKey);
		task.setNextRunTime(new Date());
		task.setRunCount(0);
		task.setFactTryAgainCount(0);
		taskService.insertTask(task);
	}
}
